home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9314 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  57 lines

  1. Newsgroups: comp.windows.x.motif,comp.lang.c++
  2. Path: uu4news.netcom.com!amc-gw!curtis
  3. From: curtis@amc.com (Curtis Green)
  4. Subject: Re: MOTIF Callbacks, C++ Member Functions - SOLVED
  5. Message-ID: <1996Feb29.210244.8595@amc.com>
  6. Organization: Applied Microsystems Corporation
  7. X-Newsreader: TIN [version 1.1 PL6]
  8. References: <4gbf05$6d8@rex.sfe.com.au>
  9. Distribution: inet
  10. Date: Thu, 29 Feb 1996 21:02:44 GMT
  11.  
  12. Paul Hatchman (paul@sfe.com.au) wrote:
  13. : danubius@chinook.halcyon.com () writes:
  14. : >Wintermute  <3mal5@qlink.queensu.ca> wrote:
  15. : >>
  16. : >>The solution was to declare a static member function which is used as a 
  17. : >>callback.  Since it is static, there is no 'this' pointer, and it works 
  18. : >>fine.  To access the particular class instance, pass the 'this' pointer 
  19. : >>as client data when installing the callback, and it will be available 
  20. : >>when the static member function is called back.
  21. : >Which is exactly the method Doug Young uses in his book on Motif with
  22. : >C++.
  23. : >Joe
  24. : I dont think there are any guarantees that a compiler will give static
  25. : functions "C" style linkage. It works with every compiler I have tried, but I
  26. : dont believe it is guaranteed to be portable.
  27.  
  28. The static member function gets placed on the heap area so at compile time
  29. the compiler has a reference to it, though it is part of a class.  The compiler
  30. needs to know where the callback is when it compiles.  Weather or not the
  31. name is mangled is inconsequential in this context. 
  32.  
  33. : Can someone give an authorative answer on this?
  34. :     - Paul
  35. : --------------------------------------------------------------------------------
  36. : Paul Hatchman,                        |  <this line intentionally left blank>
  37. : Project Leader,                       |      paul@sfe.com.au
  38. : Sydney Futures Exchange, Australia    |      Tel: +61 2 2560567
  39. : --------------------------------------------------------------------------------
  40.  
  41. --
  42. Be seeing you...
  43.  
  44. Curtis Green    |    Software Engineer
  45. curtis@amc.com    |    Applied Microsystems Embedded Systems
  46.                 |    http://www.amc.com
  47. My opinions are |
  48. expressly mine  |    This year Khan escapes Earth on the Botany Bay.
  49. on my own.      |    (Cliff Clavin, 1996)
  50.